package it721.net.helloservice;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Slf4j
public class HelloController {
    @Autowired
    private Book book;
    @Autowired
    private Phone phone;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping("hello")
    public Object index(){
        List<Book> bookList = new ArrayList<>();
        bookList.add(book);
        bookList.add(book);

        Map<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("message", "SUCCESS");
        result.put("result", bookList);
        return result;
    }
}
